﻿Public Class frmCadUsuario

    Private Sub btnCadastrar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCadastrar.Click
        If txtUser.Text = "" OrElse txtPass.Text = "" Then
            MsgBox("Favor verificar o usuário e a senha.", vbOKOnly, "Erro")
        Else
            Try
                Dim login As New SCE_ETEC_DataSetTableAdapters.LoginTableAdapter()
                Dim admin As Integer = 0
                If cbAdminstrador.Checked = True Then
                    admin = 1
                End If
                login.Insert(txtNome.Text, txtUser.Text, txtPass.Text, admin)
                MsgBox("Concluido.", vbOKOnly, "Aviso")
            Catch erro As Exception
                MsgBox(erro.Message, vbOKOnly, "Erro")
            End Try
        End If
    End Sub

    Private Sub btnSair_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSair.Click
        Me.Close()
    End Sub

    Private Sub frmCadUsuario_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        txtNome.CharacterCasing = CharacterCasing.Upper
        txtUser.CharacterCasing = CharacterCasing.Upper
    End Sub
End Class